import { changeMsgAction } from "@/store/modules/counter"
import { shallowEqual, useDispatch, useSelector } from "react-redux"
import Index from "./index"

const Index1 = function () {
  const { message } = useSelector(
    (state) => ({
      message: state.counter.message
    }),
    shallowEqual
  )
  const dispatch = useDispatch()
  console.log("app render")
  return (
    <div>
      <div style={{ border: "1px solid #ccc", padding: "10px" }}>
        <Index />
      </div>
      <div>message:{message}</div>
      <button onClick={() => dispatch(changeMsgAction(Math.random() + ""))}>
        随机字符
      </button>
    </div>
  )
}

export default Index1
